package com.dancun.controller;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ConfigurationController implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("forward:/SelectLongin.html");
        registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
    }
//    @Override
//    public void registerErrorPages(ErrorPageRegistry registry) {
//        ErrorPage error404 = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
//        ErrorPage error500 = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
//        ErrorPage e400 = new ErrorPage(HttpStatus.BAD_REQUEST,"/500.html");
//        registry.addErrorPages(error404, error500,e400);
//    }


}
